package com.hzzh.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hzzh.dao.MeetingDAO;
import com.hzzh.dao.MeetingParticipantsDAO;
import com.hzzh.vo.Employee;
import com.hzzh.vo.Meeting;

/**
 * Servlet implementation class ViewMyMeetingDetailServlet
 */
@WebServlet("/ViewMyMeetingDetailServlet")
public class ViewMyMeetingDetailServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ViewMyMeetingDetailServlet() {
        super();
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		//查看我的会议信息
		//获取参数meetingid
		int meetingid=Integer.parseInt(request.getParameter("meetingid"));
		
		MeetingDAO meetingDao=new MeetingDAO();
		MeetingParticipantsDAO parDao=new MeetingParticipantsDAO();	
		//通过meetingid查询会议信息
		Meeting meeting=meetingDao.selectById(meetingid);
		//通过meetingid查询参会人员
		List<Employee> employeesList=parDao.selectAllEmployeesByMeetingId(meeting.getMeetingid());
		request.setAttribute("meeting", meeting);
		request.setAttribute("employeesList", employeesList);
		request.getRequestDispatcher("mymeetingdetail.jsp").forward(request, response);
	}

}
